#ifndef	_COMPAT_SOCKINET_H_
#define	_COMPAT_SOCKINET_H_

#ifdef	__cplusplus
extern "C" {
#endif

#include <compat/define.h>

#define VALID_HOSTNAME_LEN	255	/* RFC 1035 */
#define VALID_LABEL_LEN		63	/* RFC 1035 */

#define DONT_GRIPE		0
#define DO_GRIPE		1


	/*
typedef union {
	struct sockaddr_storage ss;
#ifdef AF_INET6
	struct sockaddr_in6 in6;
#endif
	struct sockaddr_in in;
#ifdef _UNIX
	struct sockaddr_un un;
#endif
	struct sockaddr sa;
} OS_SOCKADDR;

*/

int valid_hostaddr(const char *, int);
int valid_ipv4_hostaddr(const char *, int);
int valid_ipv6_hostaddr(const char *, int);

int is_ip(const char *ip);
int is_ipv4(const char *ip);
int is_ipv6(const char *ip);
int ipv4_addr_valid(const char *addr);


#ifndef INET_ADDRSTRLEN
#define INET_ADDRSTRLEN   (sizeof("255.255.255.255") - 1)
#endif // !INET_ADDRSTRLEN


#ifndef INET6_ADDRSTRLEN
#define INET6_ADDRSTRLEN   (sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255") - 1)
#endif // !INET6_ADDRSTRLEN

int		os_inet_pton(int af, const char *src, void *dst);
char*	os_inet_ntop(int af, const void *src, char *buf, size_t size);

#ifdef	__cplusplus
}
#endif

#endif

